package com.niiwoo.civet.user.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 用户状态类型
 */
@Getter
@AllArgsConstructor
public enum UserDataTypeEnum {

    PERSONAL_INFO((byte) 1, "个人资料"),
    TWO_ELEMENT((byte) 2, "二要素"),
    OCR((byte) 3, "OCR状态"),
    PORTRAIT((byte) 4, "肖像状态"),
    BIND_BANK_CARD((byte) 5, "存管开户"), // 不在数据库维护，通过账户表判断
    ZHIMA_AUTHORIZE((byte) 6, "芝麻授权"),
    FADADA_AUTHORIZE((byte) 7, "法大大授权"),
    OPERATOR_AUTHORIZE((byte) 8, "运营商"),
    SOCIAL_SECURITY_OPERATOR_AUTHORIZE((byte) 9, "社保授权"),
    R360_SOCIAL_SECURITY_OPERATOR_AUTHORIZE((byte) 10, "融360社保授权"),
    WITHHOLD_CONTRACT_SIGN((byte) 11, "（极速借）还款服务委托书生成"),
    CREDIT_CARD_AUTHORIZE((byte) 12, "信用卡授权"),
    EDUCATION_AUTHORIZE((byte) 13, "学历授权"),
    JD_AUTHORIZE((byte) 14, "京东授权"),
    TAOBAO_AUTHORIZE((byte) 15, "淘宝授权");

    private Byte value;

    private String text;

    public static UserDataTypeEnum of(byte value) {
        for (UserDataTypeEnum t : values()) {
            if (t.value == value) {
                return t;
            }
        }
        return null;
    }

    public static boolean except(Byte value, UserDataTypeEnum... status) {
        return status != null && status.length > 0 && Arrays.asList(status).contains(of(value));
    }


}
